package com.graduation.auth.config;

import com.base.model.R;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @Author: 小何
 * @Description: TODO
 * @DateTime: 2023/11/5 14:10
 **/
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    public R<String> exceptionHandler(Exception e) {
        return R.error(e.getMessage());
    }

}
